package com.amigo.online.consumer.video.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.common.core.response.Response;
import com.amigo.online.common.param.dto.pay.CreditCardPayDto;
import com.amigo.online.common.param.dto.pay.PayPromoteDto;
import com.amigo.online.consumer.video.service.PaymentService;

@RestController
@RequestMapping(value = "/pay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class PaymentController {
	
	@Autowired
	private PaymentService paymentService;
	
	@GetMapping("/getClientoken")
	public ResponseEntity<Response> getClientoken() {
		return paymentService.getClientoken();
	}
	
	@PostMapping("/createOrder")
	public ResponseEntity<Response> createOrder(@RequestBody PayPromoteDto dto) {
		return  paymentService.createOrder(dto);
	}
	//信用卡支付
	@PostMapping("/creditCardPay")
	public ResponseEntity<Response> creditCardPay(@RequestBody CreditCardPayDto dto) {
		return paymentService.creditCardPay(dto);
	}
}
